#lang racket/base
(require racket/contract
		 "definition.rkt")
(provide (all-defined-out))

(define/contract (create-observable on-subscribe)
  (-> (-> subscriber? any) observable?)
  (observable on-subscribe))

(module+ test
  (require "subscriber.rkt")
  (define obs
	(create-observable
	 (lambda (sub)
	   (on-next sub 1)
	   (on-next sub 2)
	   (on-next sub 3)
	   (on-error sub (error "error" #f))
	   (on-completed sub)
	   (on-next sub 4))))
  (subscribe obs
			 (lambda (x) (displayln x))
			 (lambda (e) (displayln "error"))
			 (lambda () (displayln "completed"))))
